package Buttons
{
	import flash.events.MouseEvent;
	/**
	 * ...
	 * @author Lokiraze
	 */
	public class NewGame extends Buttons 
	{
		
		public var game:Game;
		
		public function NewGame(g:Game)
		{
			game = g;
			
			this.Draw();
			this.addEventListener(MouseEvent.CLICK, Start);
		}
		
		public function Draw()
		{
			txtButton.selectable = false;
			txtButton.text = "New Game";
		}
		
		public function Start(e:MouseEvent)
		{
			for (var i:int = 0; i < game.gridCells.length; i++)
			{
				if (game.gridCells[i].state != "Initial")
				{
					game.gridCells[i].ResetCell();
					//game.gridCells[i].answer = 0;
					game.StartGame();
					
				}
			}
		}
	}
	
}